package com.product.system.service.impl;


import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import com.product.system.domain.response.ArgpHoliday;
import com.product.system.domain.response.ArgpHolidayLog;
import com.product.system.mapper.ArgpHolidayMapper;
import com.product.system.service.ArgpHolidayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.UUID;

@Service
public class ArgpHolidayServiceImpl implements ArgpHolidayService {

    @Autowired
    ArgpHolidayMapper argpHolidayMapper;


    @Override
    public Boolean insertArgpHoliday(ArgpHoliday argpHoliday) {


        Date startTime = argpHoliday.getStartTime();
        Date endTime = argpHoliday.getEndTime();
        long timeDiff = endTime.getTime() - startTime.getTime();
        long l = timeDiff / (1000 * 60 * 60 * 24);
        System.out.println(l+"请假的天数");
        argpHoliday.setLeaveDuration((int) l);

        return argpHolidayMapper.insertArgpHoliday(argpHoliday);
    }

    @Override
    public ArgpHoliday selectArgpHoliday(Integer id) {
        return argpHolidayMapper.selectArgpHoliday(id);
    }

    @Override
    public List<ArgpHoliday> selectHolidayList() {
        return argpHolidayMapper.selectHolidayList();
    }

    @Override
    public Boolean updataStatusWait(int id) {
        return argpHolidayMapper.updataStatusWait(id);
    }

    @Override
    public Boolean insertArgpHolidayLog(ArgpHolidayLog argpHolidayLog) {
        return argpHolidayMapper.insertArgpHolidayLog(argpHolidayLog);
    }
}
